﻿@{
    Layout = "~/Views/Shared/_Layout.cshtml";
    <script charset="utf-8" src="/resources/scripts/ajaxfileupload.js"></script>
}

@using AFT.Parking.Entity
@model EmployeeRecord
<div class="content-box">
    <!-- Content box header -->
    <div class="content-box-header clearfix">
        <h3>添加管理项</h3>
    </div>

    <!-- Content box body -->
    <div class="content-box-content">
        <div class="tab-content default-tab" id="tab2">
            <form method="post" id="frm">
                <fieldset>
                    @Html.Hidden("Id", Model.Id)
                    @Html.Hidden("TagId", Model.TagId)
                    <div class="x-tab-item">
                        <div class="x-left">
                            <p>
                                <img id="ImgShow" src="@Model.HeadImg" width="150" height="180"/><br/>
                                <a class="x-headimg" href="javascript:void(0)" id="aFile">上传头像</a>
                                @Html.Hidden("HeadImg", Model.HeadImg)
                            </p>
                        </div>
                        <div class="x-left">
                            <p class="x-p">
                                <label>姓名</label>
                                @Html.TextBox("Name", Model.Name, new {@class = "text-input x-left-input"})
                            </p>
                            <p class="x-p">
                                <label>性别</label>
                                <select name="Gender" class="text-input medium-input x-left-input">
                                    <option value="1">男</option>
                                    <option value="2">女</option>
                                </select>
                            </p>
                            <p class="x-p">
                                <label style="margin-left: -5px;">身份证</label>
                                @Html.TextBox("IdCard", Model.IdCard, new {@class = "text-input x-left-input"})
                            </p>
                            <p class="x-p">
                                <label>血型</label>
                                @Html.TextBox("BloodType", Model.BloodType, new {@class = "text-input x-left-input"})
                            </p>
                            <p class="x-p">
                                <label>手机</label>
                                @Html.TextBox("Mobile", Model.Mobile, new {@class = "text-input x-left-input"})
                            </p>
                            <p class="x-p">
                                <label style="margin-left: -18px;">出生日期</label>
                                @Html.TextBox("Birthday", Model.Birthday, new {@class = "text-input x-left-input"})
                            </p>
                            <p class="x-p">
                                <label>籍贯</label>
                                @Html.TextArea("Hometown", Model.Hometown, 3, 0, new {@class = "text-input", style = "width:305px !important;"})
                            </p>
                        </div>
                        <div style="clear: both;"></div>

                    </div>
                    <div>
                        <p>
                            <label>二维码名称 (注:二维码名称请尽量不一致，便于区分)</label>
                            @if (Model.Id > 0)
                            {
                                @Html.TextBox("TagName", Model.TagName, new { @class = "text-input x-input", @readonly="readonly", style = "background: #E4E4E4;cursor:not-allowed" })
                            }
                            else
                            {
                                @Html.TextBox("TagName", Model.TagName, new { @class = "text-input x-input" })
                            }
                        </p>
                        <p>
                            <label>紧急联系人</label>
                            <input type="text" name="UrgentContactName" value="@Model.UrgentContactName" class="text-input x-contacter" placeholder="联系人姓名"/>
                            <input type="text" name="UrgentContactNum" value="@Model.UrgentContactNum" class="text-input x-contact-num" placeholder="联系人电话"/>
                        </p>
                        <p>
                            <label>工种</label>
                            @Html.TextBox("JobType", Model.JobType, new {@class = "text-input x-input"})
                        </p>
                        <p>
                            <label>劳务公司</label>
                            @Html.TextBox("ServiceCompany", Model.ServiceCompany, new {@class = "text-input x-input"})
                        </p>
                        <p>
                            <label>劳务公司联系人</label>
                            <input type="text" name="CompanyContactName" value="@Model.CompanyContactName" class="text-input x-contacter" placeholder="联系人姓名"/>
                            <input type="text" name="CompanyContactNum" value="@Model.CompanyContactNum" class="text-input x-contact-num" placeholder="联系人电话"/>
                        </p>
                        <p class="x-btns">
                            <input class="button x-btn" type="submit" id="btnSubmit" value="&nbsp;保 存&nbsp;"/>
                            <input class="button x-btn" type="button" id="btnBack" value="&nbsp;返 回&nbsp;"/> <br/>
                            <span class="input-notification @ViewBag.Icon png_bg">@ViewBag.Message</span>
                            <input type="hidden" id="hd_backUrl" value="@Url.Action("EmployeeRecordList")">
                        </p>
                    </div>
                </fieldset>
                <div class="clear"></div>
            </form>
        </div>
    </div>
</div>
<script>
    new AjaxUpload($("#aFile"), {
        action: '@Url.Action("UpLoadFile")',
        data: { folderName: "Employee"},
        name: 'UploadImg',
        responseType: "json",
        onSubmit: function (file, extension) {
        },
        onComplete: function (file, data) {
            console.log(data);
            if (data.Value) {
                $("#ImgShow").attr("src", data.Result[0]);
                $('#HeadImg').val(data.Result[0]);
            }
            else {
                alert("上传失败。");
            }
        }
    });
</script>
<script type="text/javascript">
    $(function () {
        laydate({
            elem: '#Birthday'
        });
    });
</script>
